<template>
	<view class="container">
		<view class="ti_header flex flex-align">
			<view class="jilu" @click="go_url('/pages/wallet/tixian_record')">提现记录</view>
			<view class="">
				<view class="wenzi">可提现余额</view>
				<view class="price">￥ <text>{{regInfo.balance1}}</text></view>
			</view>
		</view>
		<view class="ti_fangshi">
			<view class="title">提现方式</view>
			<!-- <view class="list flex flex-align flex-bt" @click="tabs_check('银行卡')" v-if="dataInfo.is_default==1">
				<view class="left flex flex-align">
					<tui-icon name="bankcard-fill" color="#ffaf18" :size="30"></tui-icon>
					<view>银行卡</view>
				</view>
				<view class="right">
					<radio value="yue" name='yue' style="transform: scale(.8);" :checked='is_check=="银行卡"' color='#000' />
				</view>
			</view>
			<view class="list flex flex-align flex-bt" @click="tabs_check('支付宝')" v-if="dataInfo.is_default==3">
				<view class="left flex flex-align">
					<tui-icon name="alipay" color="#3a73f6" :size="30"></tui-icon>
					<view>支付宝</view>
				</view>
				<view class="right">
					<radio value="yue" name='yue' style="transform: scale(.8);" :checked='is_check=="支付宝"' color='#000' />
				</view>
			</view> -->
			<view class="list flex flex-align flex-bt" @click="tabs_check('微信')">
				<view class="left flex flex-align">
					<tui-icon name="wechat" color="#51a938" :size="30"></tui-icon>
					<view>微信</view>
				</view>
				<view class="right">
					<radio value="yue" name='yue' style="transform: scale(.8);" :checked='is_check=="微信"' color='#bbe68c' />
				</view>
			</view>
			<!-- <view class="shoukuan flex flex-align flex-center" @click="go_url('/pages/bind_bank/bank_list')" v-if="withdraw.length<3">
				添加收款方式 +
			</view> -->
		</view>
		<view class="ti_fangshi">
			<view class="list">
				<view class="title">提现金额</view>
				<view class="ti_jine">
					<view class="flex flex-align">
						<view class="fuhao">￥</view>
						<input type="number" :placeholder="'最低提现金额'+regInfo.min+'元'" v-model="money">
					</view>
				</view>
			</view>
			<!-- <view class="list">
				<view class="title">姓名</view>
				<view class="ti_jine">
					<view class="flex flex-align">
						<input type="text" placeholder="请输入姓名" v-model="name">
					</view>
				</view>
			</view>
			<view class="list">
				<view class="title">身份证号</view>
				<view class="ti_jine">
					<view class="flex flex-align">
						<input type="text" placeholder="请输入身份证号" v-model="id_card">
					</view>
				</view>
			</view>
			<view class="list">
				<view class="title">开户行</view>
				<view class="ti_jine">
					<view class="flex flex-align">
						<input type="text" placeholder="请输入开户行" v-model="bank_name">
					</view>
				</view>
			</view>
			
			<view class="list">
				<view class="title">银行卡号</view>
				<view class="ti_jine">
					<view class="flex flex-align">
						<input type="number" placeholder="请输入银行卡号" v-model="bank_number">
					</view>
				</view>
			</view> -->
			<view class="shouxu flex flex-align flex-end">
				<!-- <view class="left" v-if="regInfo.rate!=0">手续费{{regInfo.rate}}%</view> -->
				<view class="right" @click="getAll">全部提现</view>
			</view>
		</view>
		
		
		<view class="zhuanzhang">
			<view class="btn hei" @click="submite">提现</view>
		</view>
		<!-- <view class="tishi" style="padding-left: 30rpx;color: #f20;">
			温馨提示:提现到填写的银行卡,提现前请仔细确认
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				siteList:[],
				type:1,
				mobile:'',
				price:'',
				is_hei:false,
				tabs:1,
				is_check:'微信',
				money:'',
				datas:'',
				regInfo:'',
				tixianInfo:'',
				type_name:'',
				withdraw:'',
				dataInfo:'',
				bank_name:'',
				name:'',
				bank_number:'',
				id_card:''
			}
		},
		onLoad(e) {
			let that = this
			// that.getData()
			that.getTixian()
		},
		methods: {
			go_url(e){
				console.log(e)
				let that = this
				that.tui.href(e)
			},
			tabs_check(e){
				console.log(e)
				this.is_check = e
			},
			get_int(){
				if(this.money==''){
					this.is_hei = false
				}else{
					this.is_hei = true
				}
			},
			getAll(){
				this.money = this.regInfo.balance1
				if(this.money>=10){
					this.is_hei = true
				}
			},
			submite(){
				let that = this
				if(that.money==''){
					that.tui.toast('提现金额不能为空')
					return false
				}
				
				that.tui.request("api.auth.transfer/add", "POST", {amount:that.money,bank_name:that.bank_name,bank_user:that.name,bank_code:that.bank_number,id_card:that.id_card}, false, false, true).then((res) => {
					that.tui.toast('提现成功')
					that.money = ''
					that.bank_name = ''
					that.name = ''
					that.bank_number = ''
					that.id_card = ''
					that.getData()
				}).catch((res) => {
					
				})
			},
			tab(e){
				let that = this
				that.mobile = ''
				that.money = ''
				that.tabs = e
			},
			getData(){
				let that = this
				that.tui.request("v1/wallet/info", "get", {}, false, false, true).then((res) => {
					that.datas = res
				}).catch((res) => {
					
				})
			},
			
			getTixian(){
				let that = this
				that.tui.request("api.auth.transfer/withdrawInfo", "get", {}, false, false, true).then((res) => {
				
					that.regInfo = res.data
					
					
				}).catch((res) => {
					
				})
			},
			
		}
	}
</script>

<style lang="scss">
	page{background: #fff;padding-top: 30rpx;}
	.btn{background: #bbe68c;color: #fff;text-align: center;line-height: 90rpx;}
	.ti_header{background: url('https://firework.cyx.zzcyx1688.cn/web/static/tixian_bg.png') no-repeat;background-size: 100% 100%;width: 655rpx;height: 262rpx;margin: 0rpx auto 30rpx;
		color: #fff;padding: 0 40rpx;box-sizing: border-box;font-weight: bold;position: relative;
		.wenzi{font-size: 30rpx;}
		.price{
			text{font-size: 48rpx;}
		}
		.jilu{position: absolute;right: 30rpx;top: 30rpx;}
	}
	.ti_fangshi{width: 655rpx;margin: 30rpx auto;background: #fff;box-shadow: 1px 1px 12px 1px #f5f5f5;box-sizing: border-box;
		padding:0 30rpx;border-radius: 10rpx;
		.list{
			.left{
				view{margin-left: 10rpx;}
			}
		}
		.ti_jine{padding: 0 0 10rpx 0 ;border-bottom: 1px solid #eee;
			.fuhao{font-size: 36rpx;}
			input{width: 100%;padding-left: 15rpx;font-size: 26rpx;}
		}
		.shouxu{padding: 20rpx 0;
			.right{color: #ff325d;}
		}
	}
	.shoukuan{padding: 30rpx 0;color: #ff325d;}
	.zhuanzhang{margin: 80rpx 30rpx;
		.btn{border-radius: 60rpx;}
	}
	.title{font-size: 28rpx;padding: 20rpx 0;}
</style>